﻿using System;
using System.Collections;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            Hashtable hashtable = new Hashtable();
            hashtable.Add(1, "初级.NET");
            hashtable.Add(2, ".NET");
            hashtable.Add(3, "高级.NET");
            Console.WriteLine("输入你想要的图书编号：");
            int id = int.Parse(Console.ReadLine());
            bool fl = hashtable.ContainsKey(id);
            if(fl)
            {
                Console.WriteLine("你查找的图书名称为:《{0}》", hashtable[id].ToString()) ;
            }
            else
            {
                Console.WriteLine("你所查找的图书不存在");
            }
            Console.WriteLine("所有的图书信息如下：");
            foreach (DictionaryEntry a in hashtable)
            {
                int key = (int)a.Key;
                string value = a.Value.ToString();
                Console.WriteLine("图书编号：{0},图书名称：《{1}》",key,value);
            }
        }
    }
}
